package org.td.engine.entity.tower;

import org.td.engine.entity.BuildingClass;
import org.td.engine.entity.ParameterMap;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class TowerClass extends BuildingClass {

    private int height;
    private List<TurretContainer> turretContainerList;
    
    public TowerClass(ParameterMap parameterMap) {
        super(parameterMap);
        turretContainerList = parameterMap.getValue("turretContainerList", List.class); //
        assetFile = "faces/14";
    }

    public List<TurretContainer> getTurretContainerList() {
        return turretContainerList;
    }

    public static TowerClass getRandom() {
        Random rnd = new Random();
        ParameterMap parameterMap = new ParameterMap();
        int listSize = rnd.nextInt(4) + 1;
        System.out.println(listSize);
        List<TurretContainer> turretContainerList = new ArrayList<TurretContainer>(listSize);
        for (int i = 0; i < listSize; i++) {
            int cx = ((i) % 2) * 32 - 16;
            int cy = ((i) / 2) * 32 - 16;
            TurretContainer container = new TurretContainer(cx, cy, 0, 0);
            turretContainerList.add(container);
        }
        parameterMap.putValue("turretContainerList", turretContainerList);
        parameterMap.putValue("width", 1);
        parameterMap.putValue("height", 1);
        return new TowerClass(parameterMap);
    }

    
}
